﻿using MahApps.Metro.Controls.Dialogs;
using System.ComponentModel;
using System.Threading.Tasks;

namespace PDFDesign.ViewModel
{
    public class BaseViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        protected void OnPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }

        /// <summary>
        /// 提示消息
        /// </summary>
        /// <param name="message"></param>
        public Task<MessageDialogResult> ShowMessage(string message) => DialogCoordinator.Instance.ShowMessageAsync(this, "温馨提示", message, MessageDialogStyle.Affirmative);

        /// <summary>
        /// 提示框
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        public Task<MessageDialogResult> ShowMessageBox(string message) => DialogCoordinator.Instance.ShowMessageAsync(this, "温馨提示", message, MessageDialogStyle.AffirmativeAndNegative);

        /// <summary>
        /// 输入框
        /// </summary>
        /// <param name="title"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public Task<string> ShowInputDialog(string title, string message) => DialogCoordinator.Instance.ShowInputAsync(this, title, message, new MetroDialogSettings());
    }
}
